﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IGGCore
{
    public class TeamCruncher
    {
        private static List<StandingTeam> standingTeams = new List<StandingTeam>();

        // COLLECTION OF TEAMS AND STATS LEADERS
        public static Dictionary<string, List<string>> teamLeaders = new Dictionary<string, List<string>>();

        public static void AddTeamLeaderStats(string team, string line)
        {
            if (teamLeaders.ContainsKey(team))
            {
                if (teamLeaders[team] == null)
                {
                    teamLeaders[team] = new List<string>();
                }
                teamLeaders[team].Add(line);
            }
            else
            {
                teamLeaders[team] = new List<string>();
                teamLeaders[team].Add(line);
            }
            
        }

        public static void SetStandingTeam(StandingTeam team)
        {
            standingTeams.Add(team);
        }

        public static void CrunchTeam(Scoreboard board)
        {
            Team team = new Team();
            SetTeamCity(team, board.ActiveTeam.Code);
            SetTeamName(team, board.ActiveTeam.Code);
            SetTeamDivision(team, board.ActiveTeam.Code);
            SetTeamFacts(team, board.ActiveTeam.Code);
            SetTeamBeatWriters(team, board.ActiveTeam.Code);
            SetTeamRSS(team, board.ActiveTeam.Code);
            SetTeamDepthChart(team, board.ActiveTeam.Code);
            board.ActiveTeam = team;
        }

        public static void CrunchTeam(Team team)
        {
            SetTeamCity(team, team.Code);
            SetTeamName(team, team.Code);
            SetTeamDivision(team, team.Code);
            SetTeamFacts(team, team.Code);
            SetTeamBeatWriters(team, team.Code);
            SetTeamRSS(team, team.Code);
            SetTeamDepthChart(team, team.Code);
        }

        public static string GetRandomCode()
        {
            string[] codes = { "LAA", "ATL", "ARI", "BAL", "BOS", "CHC", "CHW", "CIN", "CLE", "COL", "DET", "HOU",
                               "KC", "LAD", "MIN", "MIL", "NYM", "NYY", "OAK", "PHI", "PIT", "SD", "SF", "SEA", "STL", 
                               "TB", "TEX", "TOR", "WAS"};
            Random rnd = new Random();
            return codes[rnd.Next(codes.Length)];
        }

        /// <summary>
        /// THE TEAM CITY
        /// </summary>
        private static void SetTeamCity(Team team, string code)
        {
            switch (code.ToUpper())
            {
                case "LAA":
                    team.City = "Los Angeles";
                    team.AbbrName = "L.A. Angels";
                    team.AltCode = code.ToUpper();
                    break;
                case "ATL":
                    team.City = "Atlanta";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "ARI":
                    team.City = "Arizona";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "BAL":
                    team.City = "Baltimore";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "BOS":
                    team.City = "Boston";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "CHC":
                    team.City = "Chicago";
                    team.AbbrName = "Chi. Cubs";
                    team.AltCode = code.ToUpper();
                    break;
                case "CHW":
                    team.City = "Chicago";
                    team.AbbrName = "Chi. White Sox";
                    team.AltCode = code.ToUpper();
                    break;
                case "CIN":
                    team.City = "Cincinnati";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "CLE":
                    team.City = "Cleveland";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "COL":
                    team.City = "Colorado";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "DET":
                    team.City = "Detroit";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "HOU":
                    team.City = "Houston";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "KC":
                    team.City = "Kansas City";
                    team.AbbrName = team.City;
                    team.AltCode = "KCR";
                    break;
                case "LAD":
                    team.City = "Los Angeles";
                    team.AbbrName = "L.A. Dodgers";
                    team.AltCode = code.ToUpper();
                    break;
                case "MIL":
                    team.City = "Milwaukee";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "MIA":
                    team.City = "Miami";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "MIN":
                    team.City = "Minnesota";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "NYM":
                    team.City = "New York";
                    team.AbbrName = "N.Y. Mets";
                    team.AltCode = code.ToUpper();
                    break;
                case "NYY":
                    team.City = "New York";
                    team.AbbrName = "N.Y. Yankees";
                    team.AltCode = code.ToUpper();
                    break;
                case "OAK":
                    team.City = "Oakland";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "PHI":
                    team.City = "Philadelphia";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "PIT":
                    team.City = "Pittsburgh";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "SD":
                    team.City = "San Diego";
                    team.AbbrName = team.City;
                    team.AltCode = "SDP";
                    break;
                case "SF":
                    team.City = "San Francisco";
                    team.AbbrName = team.City;
                    team.AltCode = "SFG";
                    break;
                case "SEA":
                    team.City = "Seattle";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "STL":
                    team.City = "St. Louis";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "TB":
                    team.City = "Tampa Bay";
                    team.AbbrName = team.City;
                    team.AltCode = "TBR";
                    break;
                case "TEX":
                    team.City = "Texas";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "TOR":
                    team.City = "Toronto";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
                case "WAS":
                    team.City = "Washington";
                    team.AbbrName = team.City;
                    team.AltCode = code.ToUpper();
                    break;
            }
        }

        /// <summary>
        /// THE TEAM NAME
        /// </summary>
        private static void SetTeamName(Team team, string code)
        {
            switch (code.ToUpper())
            {
                case "LAA":
                    team.Name = "Angels";
                    break;
                case "ATL":
                    team.Name = "Braves";
                    break;
                case "ARI":
                    team.Name = "Diamondbacks";
                    break;
                case "BAL":
                    team.Name = "Orioles";
                    break;
                case "BOS":
                    team.Name = "Red Sox";
                    break;
                case "CHC":
                    team.Name = "Cubs";
                    break;
                case "CHW":
                    team.Name = "White Sox";
                    break;
                case "CIN":
                    team.Name = "Reds";
                    break;
                case "CLE":
                    team.Name = "Indians";
                    break;
                case "COL":
                    team.Name = "Rockies";
                    break;
                case "DET":
                    team.Name = "Tigers";
                    break;
                case "HOU":
                    team.Name = "Astros";
                    break;
                case "KC":
                    team.Name = "Royals";
                    break;
                case "LAD":
                    team.Name = "Dodgers";
                    break;
                case "MIL":
                    team.Name = "Brewers";
                    break;
                case "MIA":
                    team.Name = "Marlins";
                    break;
                case "MIN":
                    team.Name = "Twins";
                    break;
                case "NYM":
                    team.Name = "Mets";
                    break;
                case "NYY":
                    team.Name = "Yankees";
                    break;
                case "OAK":
                    team.Name = "Athletics";
                    break;
                case "PHI":
                    team.Name = "Phillies";
                    break;
                case "PIT":
                    team.Name = "Pittsburgh";
                    break;
                case "SD":
                    team.Name = "Padres";
                    break;
                case "SF":
                    team.Name = "Giants";
                    break;
                case "SEA":
                    team.Name = "Mariners";
                    break;
                case "STL":
                    team.Name = "Cardinals";
                    break;
                case "TB":
                    team.Name = "Rays";
                    break;
                case "TEX":
                    team.Name = "Rangers";
                    break;
                case "TOR":
                    team.Name = "Blue Jays";
                    break;
                case "WAS":
                    team.Name = "Nationals";
                    break;
            }
        }

        private static void SetTeamStandings(Team team)
        {
            bool found = false;
            foreach(StandingTeam standTeam in standingTeams)
            {
                if (standTeam.team == team.AbbrName)
                {
                    team.Wins = int.Parse(standTeam.w);
                    team.Losses = int.Parse(standTeam.l);
                    team.GamesBack = standTeam.gb;
                    team.LastTen = standTeam.last10;
                    team.Streak = standTeam.strk;
                    team.Percent = standTeam.pct;
                    found = true;
                    break;
                }
            }
            if (found == false)
            {
                // Uh Oh? Why?
                int i = 0;
            }
        }

        /// <summary>
        /// THE TEAM DIVISION
        /// </summary>
        private static void SetTeamDivision(Team team, string code)
        {
            SetTeamStandings(team);
            switch (code.ToUpper())
            {
                case "LAA":
                    team.Division = CoreConstants.STANDINGS_ALW_URL;
                    break;
                case "ATL":
                    team.Division = CoreConstants.STANDINGS_NLE_URL;
                    break;
                case "ARI":
                    team.Division = CoreConstants.STANDINGS_NLW_URL;
                    break;
                case "BAL":
                    team.Division = CoreConstants.STANDINGS_ALE_URL;
                    break;
                case "BOS":
                    team.Division = CoreConstants.STANDINGS_ALE_URL;
                    break;
                case "CHC":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "CHW":
                    team.Division = CoreConstants.STANDINGS_ALC_URL;
                    break;
                case "CIN":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "CLE":
                    team.Division = CoreConstants.STANDINGS_ALC_URL;
                    break;
                case "COL":
                    team.Division = CoreConstants.STANDINGS_NLW_URL;
                    break;
                case "DET":
                    team.Division = CoreConstants.STANDINGS_ALC_URL;
                    break;
                case "HOU":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "KC":
                    team.Division = CoreConstants.STANDINGS_ALC_URL;
                    break;
                case "LAD":
                    team.Division = CoreConstants.STANDINGS_NLW_URL;
                    break;
                case "MIL":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "MIA":
                    team.Division = CoreConstants.STANDINGS_NLE_URL;
                    break;
                case "MIN":
                    team.Division = CoreConstants.STANDINGS_ALC_URL;
                    break;
                case "NYM":
                    team.Division = CoreConstants.STANDINGS_NLE_URL;
                    break;
                case "NYY":
                    team.Division = CoreConstants.STANDINGS_ALE_URL;
                    break;
                case "OAK":
                    team.Division = CoreConstants.STANDINGS_ALW_URL;
                    break;
                case "PHI":
                    team.Division = CoreConstants.STANDINGS_NLE_URL;
                    break;
                case "PIT":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "SD":
                    team.Division = CoreConstants.STANDINGS_NLW_URL;
                    break;
                case "SF":
                    team.Division = CoreConstants.STANDINGS_NLW_URL;
                    break;
                case "SEA":
                    team.Division = CoreConstants.STANDINGS_ALW_URL;
                    break;
                case "STL":
                    team.Division = CoreConstants.STANDINGS_NLC_URL;
                    break;
                case "TB":
                    team.Division = CoreConstants.STANDINGS_ALE_URL;
                    break;
                case "TEX":
                    team.Division = CoreConstants.STANDINGS_ALW_URL;
                    break;
                case "TOR":
                    team.Division = CoreConstants.STANDINGS_ALE_URL;
                    break;
                case "WAS":
                    team.Division = CoreConstants.STANDINGS_NLE_URL;
                    break;
            }
        }

        /// <summary>
        /// TEAM FACTS
        /// </summary>
        private static void SetTeamFacts(Team team, string code)
        {
            team.Facts = new List<string>();
            switch (code.ToUpper())
            {
                case "LAA":
                    break;
                case "ATL":
                    break;
                case "ARI":
                    break;
                case "BAL":
                    break;
                case "BOS":
                    break;
                case "CHC":
                    break;
                case "CHW":
                    break;
                case "CIN":
                    break;
                case "CLE":
                    break;
                case "COL":
                    break;
                case "DET":
                    break;
                case "HOU":
                    break;
                case "KC":
                    break;
                case "LAD":
                    break;
                case "MIL":
                    break;
                case "MIA":
                    break;
                case "MIN":
                    team.Facts.Add("Established in 1894.");
                    break;
                case "NYM":
                    team.Facts.Add("Established in 1962.");
                    team.Facts.Add("Playing at Citi Field since 2009.");
                    break;
                case "NYY":
                    team.Facts.Add("Established in 1901.");
                    team.Facts.Add("Based in New York since 1903.");
                    team.Facts.Add("Named Yankees since 1913.");
                    break;
                case "OAK":
                    team.Facts.Add("Established in 1901.");
                    team.Facts.Add("Based in Oakland since 1968.");
                    team.Facts.Add("Named Oakland Athletics since 1981.");
                    team.Facts.Add("Named Oakland A's from 1970 to 1980");
                    break;
                case "PHI":
                    team.Facts.Add("Established in 1883.");
                    team.Facts.Add("Two World Series titles (1980 and 2008).");
                    team.Facts.Add("Referred to as the Bluejays from 1943 through 1948 despite formal name remaining Phillies.");
                    team.Facts.Add("Referred to as the Philadelphia Quakers from 1883 through 1889.");
                    team.Facts.Add("Playing at Citizens Bank Park since 2004.");
                    team.Facts.Add("Played at Veterans Stadium from 1971 to 2003.");
                    team.Facts.Add("Played at Shibe Park from 1938 to 1970.");
                    team.Facts.Add("Played at Baker Bowl from 1883 to 1938.");
                    team.Facts.Add("Seven NL Pennants (1915, 1950, 1980, 1983, 1993, 2008 and 2009).");
                    team.Facts.Add("Eleven East Division titles.");
                    team.Facts.Add("Oldest continuous, one-name, one-city franchise in all of professional American sports.");
                    team.Facts.Add("Won in 1915 their first pennant, thanks to the pitching of Grover Cleveland Alexander and the batting prowess of Gavvy Cravath.");
                    team.Facts.Add("Only one winning season from 1918 to 1948.");
                    team.Facts.Add("Chuck Klein won the Most Valuable Player Award in 1932 and the National League Triple Crown in 1933.");
                    team.Facts.Add("Won the Pennant in 1950 with the Whiz Kids, Robin Roberts and Richie Ashburn");
                    team.Facts.Add("in 1961, the Phillies lost 23 games in a row.");
                    team.Facts.Add("in 1964, Jim Bunning pitched a perfect game against the Mets.");
                    break;
                case "PIT":
                    team.Facts.Add("Established in 1882.");
                    team.Facts.Add("Playing at PNC Park since 2001.");
                    team.Facts.Add("Played at Three Rivers Stadium from 1970 to 2000.");
                    team.Facts.Add("Played at Forbes Field from 1909 to 1970.");
                    team.Facts.Add("Played at Exposition Park (II) from 1891 to 1909.");
                    break;
                case "SD":
                    team.Facts.Add("Established in 1969.");
                    team.Facts.Add("Playing at PETCO Park since 2004.");
                    team.Facts.Add("Played at Qualcomm Stadium from 1969 to 2003.");
                    team.Facts.Add("Two NL Pennants (1984 and 1998).");
                    team.Facts.Add("Five West Division titles (1984, 1996, 1998, 2005 and 2006).");
                    team.Facts.Add("Lost their two World Series.");
                    break;
                case "SF":
                    team.Facts.Add("Established in 1883.");
                    team.Facts.Add("Based in San Francisco since 1958.");
                    team.Facts.Add("Known as the New York Giants from 1885 through 1957.");
                    team.Facts.Add("Known as the New York Gothams from 1883 through 1885.");
                    team.Facts.Add("Playing at AT&T Park since 2000.");
                    team.Facts.Add("Played at Candlestick Park  from 1960 to 1999.");
                    team.Facts.Add("Played at Seals Stadium from 1958 to 1959.");
                    team.Facts.Add("Played at Polo Grounds IV from 1911 to 1957.");
                    break;
                case "SEA":
                    team.Facts.Add("Established in 1977.");
                    team.Facts.Add("Playing at Safeco Field since 1999.");
                    team.Facts.Add("Played at the Kingdome from 1977 to 1999.");
                    team.Facts.Add("Three West Division titles (1995, 1997 and 2001).");
                    team.Facts.Add("One wild-card berth in 2000.");
                    team.Facts.Add("First winning season in 1991.");
                    team.Facts.Add("Won 116 games in 2001, a AL record.");
                    team.Facts.Add("Owned by Nintendo of America.");
                    team.Facts.Add("The Mariners were created as a result of a lawsuit.");
                    team.Facts.Add("Lou Piniella helm the team from 1993 to 2002.");
                    break;
                case "STL":
                    team.Facts.Add("Established in 1882.");
                    team.Facts.Add("Known as the Cardinals since 1900.");
                    team.Facts.Add("Known as the Perfectos in 1899.");
                    team.Facts.Add("Known as the Browns from 1882 through 1898.");
                    team.Facts.Add("Playing at Busch Stadium (III) since 2006.");
                    team.Facts.Add("Played at Busch Stadium (II) from 1966 to 2005.");
                    team.Facts.Add("Played at Busch Stadium (I) from 1920 to 1965.");
                    team.Facts.Add("Played at Robison Field from 1893 to 1920.");
                    team.Facts.Add("Played at Sportsman's Park  from 1882 to 1892.");
                    team.Facts.Add("Eleven World Series titles.");
                    team.Facts.Add("Won the World Series in 1926, 1931, 1934, 1942, 1944, 1946, 1964, 1967, 1982, 2006 and 2011.");
                    team.Facts.Add("Eighteen NL Pennants.");
                    break;
                case "TB":
                    team.Facts.Add("Established in 1998.");
                    team.Facts.Add("Known as the Rays since 2008.");
                    team.Facts.Add("Known as the Devil Rays from 1998 through 2007.");
                    team.Facts.Add("Playing at Tropicana Field since 1998.");
                    team.Facts.Add("One AL Pennant, in 2008.");
                    team.Facts.Add("Two East Division titles (2008 and 2010).");
                    team.Facts.Add("One wild-card berth in 2011.");
                    team.Facts.Add("Finished in last place in nine of their first ten seasons.");
                    team.Facts.Add("First winning season in 2008.");
                    team.Facts.Add("Tampa Bay includes Tampa, St. Petersburg, Clearwater, and Bradenton.");
                    team.Facts.Add("Tony Saunders from the Florida Marlins was the first player drafted by the Devil Rays.");
                    team.Facts.Add("Before the 1998 season, veteran stars Wade Boggs, Fred McGriff, and Wilson Alvarez were acquired.");
                    team.Facts.Add("Wade Boggs is the only Ray with his number retired.");
                    break;
                case "TEX":
                    team.Facts.Add("Established in 1961.");
                    team.Facts.Add("Based in Arlington since 1972");
                    team.Facts.Add("Known as the Washington Senators from 1961 through 1971.");
                    team.Facts.Add("Playing at Rangers Ballpark in Arlington since 1994.");
                    team.Facts.Add("Played at Arlington Stadium from 1972 to 1993.");
                    team.Facts.Add("Played at RFK Stadium from 1962 to 1971.");
                    team.Facts.Add("Played at Griffith Stadium in 1961.");
                    team.Facts.Add("Two AL Pennants (2010 and 2011).");
                    team.Facts.Add("Five West Division titles (1996, 1998, 1999, 2010 and 2011).");
                    team.Facts.Add("Began in 1961 as the Senators, an expansion team awarded to Washington.");
                    team.Facts.Add("The original Washington Senators moved to Minnesota in 1960 as the Twins.");
                    team.Facts.Add("Ted Williams was the Rangers first manager in Texas.");
                    team.Facts.Add("The 1974 Rangers are the only team to finish above .500 after two consecutive 100-loss seasons.");
                    team.Facts.Add("The Rangers play most of their summer games at night.");
                    break;
                case "TOR":
                    team.Facts.Add("Established in 1977.");
                    team.Facts.Add("Two World Series titles (1992 and 1993).");
                    team.Facts.Add("Playing at Rogers Centre since 1989.");
                    team.Facts.Add("Played at Exhibition Stadium from 1977 to 1989.");
                    team.Facts.Add("Two AL Pennants (1992 and 1993).");
                    team.Facts.Add("Five East Division titles (1985, 1989, 1991, 1992 and 1993).");
                    team.Facts.Add("Owned by Rogers Communications since 2000.");
                    team.Facts.Add("First winning season in 1983.");
                    team.Facts.Add("In 1979, after a 53–109 last place finish, shortstop Alfredo Griffin was named American League co-Rookie of the Year.");
                    team.Facts.Add("Under new manager Bobby Cox, Toronto's first solid season came in 1982 as they finished 78–84.");
                    team.Facts.Add("Dave Stieb has the second highest number of wins among pitchers in the 1980s.");
                    team.Facts.Add("Faced the Kansas City Royals in the 1985 ALCS.");
                    team.Facts.Add("George Bell (.308 AVG, 47 HR, 134 RBI) was named the 1987 AL MVP.");
                    team.Facts.Add("The Jays' retractable roofed home, SkyDome, opened in 1989 mid-season.");
                    team.Facts.Add("Dave Stieb pitched a no-hitter in 1990 against the Indians.");
                    team.Facts.Add("Became in 1991 the first team ever to draw over four million fans in one season.");
                    team.Facts.Add("Signed Roger Clemens in 1997 to a 24 millions contract.");
                    team.Facts.Add("Played against the Expos for the first time in 1997.");
                    team.Facts.Add("the Blue Jays retired their first number, Roberto Alomar's #12, in 2011.");
                    break;
                case "WAS":
                    team.Facts.Add("Established in 1969.");
                    team.Facts.Add("Based in Washington D.C. since 2005");
                    team.Facts.Add("Known as the Montreal Expos from 1969 through 2004.");
                    team.Facts.Add("Playing at Nationals Park since 2008.");
                    team.Facts.Add("Played at RFK Memorial Stadium from 2005 to 2007.");
                    team.Facts.Add("Played at the Olympic Stadium from 1977 to 2004.");
                    team.Facts.Add("Played at the Parc Jarry from 1969 to 1976.");
                    team.Facts.Add("One East Division title in 1981.");
                    team.Facts.Add("As the Montreal Expos, they were the first major league team in Canada.");
                    team.Facts.Add("Only franchise with the Mariners to have never played in a World Series.");
                    team.Facts.Add("The Montreal Expos joined the National League in 1969, along with the San Diego Padres.");
                    team.Facts.Add("In 1992, Felipe Alou became the first Dominican-born manager in MLB history.");
                    team.Facts.Add("On September 29, 2004, MLB announced that the Expos would move to Washington in 2005.");
                    team.Facts.Add("The Expos played their final game on October 3, 2004 at Shea Stadium.");
                    team.Facts.Add("The Senators, a founding member of the American League, played in Washington from 1901 to 1960.");
                    team.Facts.Add("Washington spent 33 years without a baseball team.");
                    team.Facts.Add("On April 4, 2005, Brad Wilkerson (after being the last player to ever wear a Montreal Expo jersey) had the honor of being the first batter for the Washington Nationals and he promptly responded with the first hit for the new Washington incarnation of the team.");
                    break;
            }
        }

        /// <summary>
        /// THE TEAM DEPTH CHART
        /// </summary>
        private static void SetTeamDepthChart(Team team, string code)
        {
            switch (code.ToUpper())
            {
                case "LAA":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=ana";
                    break;
                case "ATL":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=atl";
                    break;
                case "ARI":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=ari";
                    break;
                case "BAL":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=bal";
                    break;
                case "BOS":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=bos";
                    break;
                case "CHC":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=chc";
                    break;
                case "CHW":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=cws";
                    break;
                case "CIN":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=cin";
                    break;
                case "CLE":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=cle";
                    break;
                case "COL":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=col";
                    break;
                case "DET":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=det";
                    break;
                case "HOU":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=hou";
                    break;
                case "KC":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=kc";
                    break;
                case "LAD":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=la";
                    break;
                case "MIL":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=mil";
                    break;
                case "MIA":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=mia";
                    break;
                case "MIN":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=min";
                    break;
                case "NYM":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=nym";
                    break;
                case "NYY":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=nyy";
                    break;
                case "OAK":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=oak";
                    break;
                case "PHI":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=phi";
                    break;
                case "PIT":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=pit";
                    break;
                case "SD":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=sd";
                    break;
                case "SF":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=sf";
                    break;
                case "SEA":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=sea";
                    break;
                case "STL":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=stl";
                    break;
                case "TB":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=tb";
                    break;
                case "TEX":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=tex";
                    break;
                case "TOR":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=tor";
                    break;
                case "WAS":
                    team.DepthChartSource = "http://www.mlb.com/team/depth_chart/index.jsp?c_id=was";
                    break;
            }
        }

        /// <summary>
        /// THE TEAM RSS FEED
        /// </summary>
        private static void SetTeamRSS(Team team, string code)
        {
            switch (code.ToUpper())
            {
                case "LAA":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/ana.xml";
                    break;
                case "ATL":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/atl.xml";
                    break;
                case "ARI":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/ari.xml";
                    break;
                case "BAL":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/bal.xml";
                    break;
                case "BOS":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/bos.xml";
                    break;
                case "CHC":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/chc.xml";
                    break;
                case "CHW":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/cws.xml";
                    break;
                case "CIN":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/cin.xml";
                    break;
                case "CLE":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/cle.xml";
                    break;
                case "COL":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/col.xml";
                    break;
                case "DET":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/det.xml";
                    break;
                case "HOU":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/hou.xml";
                    break;
                case "KC":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/kc.xml";
                    break;
                case "LAD":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/la.xml";
                    break;
                case "MIL":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/mil.xml";
                    break;
                case "MIA":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/mia.xml";
                    break;
                case "MIN":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/min.xml";
                    break;
                case "NYM":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/nym.xml";
                    break;
                case "NYY":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/nyy.xml";
                    break;
                case "OAK":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/oak.xml";
                    break;
                case "PHI":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/phi.xml";
                    break;
                case "PIT":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/pit.xml";
                    break;
                case "SD":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/sd.xml";
                    break;
                case "SF":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/sf.xml";
                    break;
                case "SEA":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/sea.xml";
                    break;
                case "STL":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/stl.xml";
                    break;
                case "TB":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/tb.xml";
                    break;
                case "TEX":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/tex.xml";
                    break;
                case "TOR":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/tor.xml";
                    break;
                case "WAS":
                    team.RssFeed = "http://partner.mlb.com/partnerxml/gen/news/rss/was.xml";
                    break;
            }
        }
        /// <summary>
        /// THE TEAM BEAT WRITERS
        /// </summary>
        private static void SetTeamBeatWriters(Team team, string code)
        {
            team.BeatWriters = new List<string>();
            switch (code.ToUpper())
            {
                case "LAA": // 2014-REVISED
                    team.BeatWriters.Add("Angels");
                    team.BeatWriters.Add("MikeDiGiovanna");
                    team.BeatWriters.Add("JeffFletcherOCR"); 
                    break;
                case "ATL": // 2014-REVISED
                    team.BeatWriters.Add("Braves");
                    team.BeatWriters.Add("mlbbowman"); 
                    team.BeatWriters.Add("ajcbraves");
                    break;
                case "ARI": // 2014-REVISED
                    team.BeatWriters.Add("dbacks");
                    team.BeatWriters.Add("nickpiecoro"); 
                    team.BeatWriters.Add("SteveGilbertMLB"); 
                    team.BeatWriters.Add("JackMagruder");
                    team.BeatWriters.Add("BertDbacks");
                    break;
                case "BAL": // 2014-REVISED
                    team.BeatWriters.Add("danconnollysun"); 
                    team.BeatWriters.Add("Britt_Ghiroli"); 
                    team.BeatWriters.Add("masnRoch");
                    team.BeatWriters.Add("EddieInTheYard");
                    team.BeatWriters.Add("Orioles");
                    break;
                case "BOS": // 2014-REVISED
                    team.BeatWriters.Add("PeteAbe"); 
                    team.BeatWriters.Add("nickcafardo"); 
                    team.BeatWriters.Add("Sean_McAdam");
                    team.BeatWriters.Add("alexspeier");
                    team.BeatWriters.Add("GordonEdes");
                    team.BeatWriters.Add("IanMBrowne");
                    team.BeatWriters.Add("RedSox");
                    break;
                case "CHC": // 2014-REVISED
                    team.BeatWriters.Add("CarrieMuskat"); 
                    team.BeatWriters.Add("BruceMiles2112");
                    team.BeatWriters.Add("CSNMooney");
                    team.BeatWriters.Add("Cubs");
                    team.BeatWriters.Add("MDGonzales"); 
                    break;
                case "CHW": // 2014-REVISED
                    team.BeatWriters.Add("CST_soxvan");
                    team.BeatWriters.Add("ChiTribKane"); 
                    team.BeatWriters.Add("scottmerkin");
                    team.BeatWriters.Add("whitesox"); 
                    break;
                case "CIN": // 2014-REVISED
                    team.BeatWriters.Add("m_sheldon");
                    team.BeatWriters.Add("ctrent"); 
                    team.BeatWriters.Add("johnfayman"); 
                    team.BeatWriters.Add("redreporter");
                    team.BeatWriters.Add("Reds");
                    break;
                case "CLE": // 2014-REVISED
                    team.BeatWriters.Add("MLBastian"); 
                    team.BeatWriters.Add("hoynsie");
                    team.BeatWriters.Add("Indians"); 
                    break;
                case "COL": // 2014-REVISED
                    team.BeatWriters.Add("TroyRenck");  
                    team.BeatWriters.Add("Rockies");  
                    team.BeatWriters.Add("psaundersdp"); 
                    team.BeatWriters.Add("RockiesReview");
                    break;
                case "DET": // 2014-REVISED
                    team.BeatWriters.Add("beckjason"); 
                    team.BeatWriters.Add("Tom_Gage");
                    team.BeatWriters.Add("matthewbmowery"); 
                    team.BeatWriters.Add("blessyouboys"); 
                    team.BeatWriters.Add("Chris_Iott");
                    team.BeatWriters.Add("tigers"); 
                    break;
                case "HOU": // 2014-REVISED
                    team.BeatWriters.Add("brianmctaggart"); 
                    team.BeatWriters.Add("ChronAstros"); 
                    team.BeatWriters.Add("AstrosCounty");
                    team.BeatWriters.Add("Astros"); 
                    break;
                case "KC": // 2014-REVISED
                    team.BeatWriters.Add("Royals");
                    team.BeatWriters.Add("McCulloughStar");
                    break;
                case "LAD": // 2014-REVISED
                    team.BeatWriters.Add("dylanohernandez"); 
                    team.BeatWriters.Add("kengurnick");
                    team.BeatWriters.Add("billplunkettocr");
                    team.BeatWriters.Add("BillShaikin");
                    team.BeatWriters.Add("Dodgers"); 
                    break;
                case "MIL": // 2014-REVISED
                    team.BeatWriters.Add("Haudricourt"); 
                    team.BeatWriters.Add("AdamMcCalvy");
                    team.BeatWriters.Add("Todd_Rosiak");
                    team.BeatWriters.Add("Brewers"); 
                    break;
                case "MIA": // 2014-REVISED
                    team.BeatWriters.Add("joecapMARLINS"); 
                    team.BeatWriters.Add("clarkspencer"); 
                    team.BeatWriters.Add("JoeFrisaro");
                    team.BeatWriters.Add("Marlins");
                    break;
                case "MIN": // 2014-REVISED
                    team.BeatWriters.Add("Twins");
                    team.BeatWriters.Add("MikeBerardino");
                    team.BeatWriters.Add("AaronGleeman");
                    break;
                case "NYM": // 2014-REVISED
                    team.BeatWriters.Add("DPLennon");
                    team.BeatWriters.Add("MartinoNYDN");
                    team.BeatWriters.Add("PSLToFlushing");
                    team.BeatWriters.Add("NYPost_Mets");
                    team.BeatWriters.Add("AnthonyDiComo");
                    team.BeatWriters.Add("AdamRubinESPN");
                    break;
                case "NYY": // 2014-REVISED
                    team.BeatWriters.Add("MarcCarig"); 
                    team.BeatWriters.Add("eboland11");
                    team.BeatWriters.Add("DanBarbarisi");
                    team.BeatWriters.Add("FeinsandNYDN");
                    team.BeatWriters.Add("LoHudYankees");
                    team.BeatWriters.Add("BryanHoch");
                    team.BeatWriters.Add("Yankees"); 
                    break;
                case "OAK": // 2014-REVISED
                    team.BeatWriters.Add("susanslusser");
                    team.BeatWriters.Add("JaneMLB");
                    team.BeatWriters.Add("JHickey3");
                    team.BeatWriters.Add("Athletics"); 
                    break;
                case "PHI": // 2014-REVISED
                    team.BeatWriters.Add("ToddZolecki"); 
                    team.BeatWriters.Add("magelb");
                    team.BeatWriters.Add("ryanlawrence21");
                    team.BeatWriters.Add("KevinCooney");
                    team.BeatWriters.Add("JSalisburyCSN"); 
                    team.BeatWriters.Add("Phillies"); 
                    break;
                case "PIT": // 2014-REVISED
                    team.BeatWriters.Add("BiertempfelTrib");
                    team.BeatWriters.Add("Pirates");
                    break;
                case "SD": // 2014-REVISED
                    team.BeatWriters.Add("FollowThePadres"); 
                    team.BeatWriters.Add("CNHpadrefan"); 
                    team.BeatWriters.Add("Padres"); 
                    team.BeatWriters.Add("UTPadres"); 
                    break;
                case "SF": // 2014-REVISED
                    team.BeatWriters.Add("hankschulman"); 
                    team.BeatWriters.Add("AmyGGiants");
                    team.BeatWriters.Add("CSNBaggs");
                    team.BeatWriters.Add("sfgiants");
                    team.BeatWriters.Add("mccoveychron"); 
                    break;
                case "SEA": // 2014-REVISED
                    team.BeatWriters.Add("TNT_Mariners");
                    team.BeatWriters.Add("RyanDivish");
                    team.BeatWriters.Add("based_ball");
                    team.BeatWriters.Add("GregJohnsMLB");
                    team.BeatWriters.Add("Mariners");
                    break;
                case "STL": // 2014-REVISED
                    team.BeatWriters.Add("dgoold");
                    team.BeatWriters.Add("LangoschMLB");
                    team.BeatWriters.Add("Cardinals");
                    break;
                case "TB": // 2014-REVISED
                    team.BeatWriters.Add("TBTimes_Rays"); 
                    team.BeatWriters.Add("wwchastain");
                    team.BeatWriters.Add("RMooneyTBO"); 
                    team.BeatWriters.Add("RaysBaseball"); 
                    break;
                case "TEX": // 2014-REVISED
                    team.BeatWriters.Add("Sullivan_Ranger");
                    team.BeatWriters.Add("BBTiA");
                    team.BeatWriters.Add("lonestarball");
                    team.BeatWriters.Add("Rangers");
                    break;
                case "TOR": // 2014-REVISED
                    team.BeatWriters.Add("gregorMLB"); 
                    team.BeatWriters.Add("TaoofStieb"); 
                    team.BeatWriters.Add("TSNScottyMac");
                    team.BeatWriters.Add("Wilnerness590");
                    team.BeatWriters.Add("JaysNationFan");
                    team.BeatWriters.Add("BlueJays");
                    break;
                case "WAS": //2014-REVISED
                    team.BeatWriters.Add("washingnats"); 
                    team.BeatWriters.Add("ZuckermanCSN"); 
                    team.BeatWriters.Add("AdamKilgoreWP"); 
                    team.BeatWriters.Add("Nationals"); 
                    break;
            }
        }
    }
}
